<?php
	@include('include/common.inc.php');	
	if($_POST['reg']==1)
	{
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?php
		if($_POST[agree]!=1)
		{
			MyNotice("先同意群格租屋會員規章才能注冊", 1, "news.php");
		}
		$user_id = work_str($_POST["user_id"], 1);			//中文标题  
		$name = work_str($_POST["name"], 1);		
		$pass1 =md5(work_str($_POST["pass1"], 1));			
		$sex = work_str($_POST["sex"], 1);			
		$mobile = work_str($_POST["mobile"], 1);		
		$birthyear = work_str($_POST["birthyear"], 1);		
		$birthmonth = work_str($_POST["birthmonth"], 1);		
		$birthday = work_str($_POST["birthday"], 1);		
		$birth =$birthyear.'-'.$birthmonth.'-'.$birthday;	
		$job = work_str($_POST["job"], 1);
		$email = work_str($_POST["email"], 1);
		
		$add1 = work_str($_POST["add1"], 1);
		$add2 = work_str($_POST["add2"], 1);
		$add3 = work_str($_POST["add3"], 1);
		$add4 = work_str($_POST["add4"], 1);
		$add5 = work_str($_POST["add5"], 1);
		$add6_1 = work_str($_POST["add6_1"], 1);
		$add6_2 = work_str($_POST["add6_2"], 1);
		$add7_1 = work_str($_POST["add7_1"], 1);
		$add7_2 = work_str($_POST["add7_2"], 1);
		$add8 = work_str($_POST["add8"], 1);

		$addc = work_str($_POST["addc"], 1);
		$addx = work_str($_POST["addx"], 1);

		$tel = work_str($_POST["tel_area"], 1).'-'.work_str($_POST["tel_area"], 1);

		$idk = work_str($_POST["idk"], 1);

		$addr =$addc.'市'.$addx.'鎮'.$add1.$add2.$add3.$add4.'巷'.$add5.'弄'.$add6_1.'之'.$add6_2.'號'.$add7_1.'樓之'.$add7_2.$add8.'室';

		$time =date('Y-m-d H:i:s');
		
	    $sel = "select * from $TBL_MEM where user_id='$user_id' or mobile='$mobile' or idk='$idk' or email ='$email'";		
		$result = mysql_query($sel);
		if(mysql_fetch_array($result))
		{
			 MyNotice("該賬戶，郵箱，身份證，手機已經被注冊", 1, "news.php");
		}else{
			$insert = "insert into $TBL_MEM (id,user_id,name,password,sex,birth,profession,mobile,email,reg_time,type,idk,addr,tel)
			values (null,'$user_id','$name','$pass1','$sex','$birth','$job','$mobile','$email','$time',1,'$idk','$addr','$tel')";
			if(mysql_query($insert))
			{
				MyNotice("房客會員注冊成功，請登錄", 2, "login.php");
			}else{
				MyNotice("信息有誤,注冊失敗", 1, "login.php");
			}
		}	
	}


	$selzc = "select * from $TBL_SET where id =1";
	$reszc = mysql_query($selzc);
	$rowzc = mysql_fetch_array($reszc);
	$rule = $rowzc[rule];

	$selxx1 = "select * from $TBL_OPTION where type=10 order by ord asc";
	$resxx1 = mysql_query($selxx1);	
	while($rowxx1 = mysql_fetch_array($resxx1))
	{
       $jobb = $jobb ."<OPTION value=$rowxx1[title]>".$rowxx1[title]."</OPTION>";
	}
	@include('right.php');
	@include('number.php');//验证码
	$smarty->assign("rule",$rule);
	$smarty->assign("jobb",$jobb);
	$smarty->assign("mem_id",$_SESSION['mem_id']);
	$smarty->assign("type",$_SESSION['type']);
	$smarty->display('landlord.html');

?>